package com.wc.acwing.贪心.公路;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/1/15 9:45
 * @description 公路
 * https://www.acwing.com/problem/content/5311/
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int maxN = 100007;
    static int n, d;
    static int[] vs = new int[maxN];
    static int[] as = new int[maxN];
    // 前缀和计算距离
    static long[] pre = new long[maxN];
    static long dis = 0;

    public static void main(String[] args) {
        n = sc.nextInt();
        d = sc.nextInt();
        for (int i = 1; i < n; i++) {
            vs[i] = sc.nextInt();
            pre[i + 1] = pre[i] + vs[i];
            dis += vs[i];
        }

        for (int i = 1; i <= n; i++) {
            as[i] = sc.nextInt();
        }
        long res = 0;

        // 当前能够行驶的距离
        long reDis = 0;
        // 当前位置坐标
        int curIdx = 1;
        while (curIdx < n) {
            // 目标地址
            int targetIdx = curIdx + 1;
            // 寻找后面更小价格的位置
            while (targetIdx < n && as[curIdx] <= as[targetIdx]) {
                targetIdx++;
            }
            // 目标距离
            long obDis = pre[targetIdx] - pre[curIdx];
            // 需要的油耗取上界
            long needOil = (obDis - reDis + d - 1) / d;
            // 要花的钱
            res += needOil * as[curIdx];
            // 到达目的地剩余的距离
            reDis = reDis + needOil * d - obDis;
            // 到达该地址
            curIdx = targetIdx;
        }
        out.println(res);
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }
}